#ifndef __VIDEO_PROTOCOL_H__
#define __VIDEO_PROTOCOL_H__

#include <stdint.h>
#include <string.h>
#include "queue.h"
#include "common.h"

#define VIDEO_PROTOCOL_DATA_SIZE (6144 * 1024)
#define MAX_VEHICLES             50
#define VIDEO_INFO_SIZE          MAX_VEHICLES
#define MAX_VIDEO_FRAME_COUNT    10

typedef struct {
    char guid[64];
    int32_t danger;
    int32_t car_color;
    int32_t plate_color;
    char plate_licence[16];
    int32_t car_type;
    int32_t car_type_toll;
    char car_brand[128];
} struct_info_t;

typedef struct {
    char guid[64];
    int8_t row;
    int8_t col;
} video_obj_info_t;

typedef struct {
    video_obj_info_t obj_info[VIDEO_INFO_SIZE];
    uint16_t obj_num;
    int64_t frame_time;
    Bitmap obj_map;
} video_frame_t;

typedef struct
{
    int16_t scale[MAX_COLS];
    Queue_t *in_struct_info_queue;
    Queue_t *in_video_frame_queue;

    Queue_t *out_struct_info_queue;
    Queue_t *out_video_frame_queue;
} video_manager_t;

void video_protocol_init(void);
void video_protocol_deinit(void);
void parse_json(const char *json_str);
struct_info_t *get_struct_info_by_guid(const char *guid, uint8_t dev_type);
struct_info_t *get_struct_info_by_radar_id(uint16_t id, uint8_t dev_type);
void print_struct_info(struct_info_t *struct_info);
bool video_detect_emergency_lane();
#endif  // __VIDEO_PROTOCOL_H__